<template>
	                                     流程信息
	<el-form :model="step" label-width="120px">
	  
  <el-form-item label="标题">
    <el-input v-model="step.stepTitle" />
  </el-form-item>
  
  <el-form-item label="处理人">
  	<el-select v-model="step.stepProcessorid" placeholder="please select your zone">
  		<el-option v-for="(item,index) in users" :label="item.userName" :value="item.userId" @click="handleChange(index)" />
  	</el-select>
  </el-form-item>
 
 <el-form-item label="处理意见">
    <el-input 
	  v-model="step.stepOpinions"
	  :rows="5"
	  type="textarea"
	  placeholder="Please input" />
 </el-form-item>
 
                                        合同信息
										
   <el-form-item label="合同种类">
      <el-select v-model="step.contractType" placeholder="please select your zone">
        <el-option label="采购" value="采购" />
        <el-option label="业务" value="业务" />
		<el-option label="劳动" value="劳动" />
      </el-select>
    </el-form-item>

    <el-form-item label="甲方">
    <el-input v-model="step.contractAparty" />
    </el-form-item>
    <el-form-item label="乙方">
    <el-input v-model="step.contractBparty" />
    </el-form-item>
	
	<el-form-item label="合同内容">
	   <el-input
	      v-model="step.contractContent"
	      :rows="5"
	      type="textarea"
	      placeholder="Please input"
	    />
	</el-form-item>
	
      <el-button type="primary" @click="onSubmit">提交</el-button>
      <el-button @click="this.$router.back()">取消</el-button>
  
  </el-form>
</template>

<script >
import qs from 'qs'
	export default {
		data() {
			return {
				user: {

				},
				post: {
					postName: '',
					postDepartment: '',
				},
				posts: [],
				step: {
					stepTitle: '',
					creatorId: this.$store.state.user.userId,
					creatorName:this.$store.state.user.userName,
					stepProcessorid: null,
					stepProcessor:'',
					stepOpinions: '',
					contractType:'',
					contractAparty:'',
					contractBparty:'',
					contractContent:'',
					stepKind:'合同申请',
					stepIsend:'否',
				},
				users: [],

			}
		},
		methods: {
			onSubmit() {
				console.log(this.step)
				let that = this
				let str = qs.stringify(this.step)
				this.$axios.get("http://localhost:8080/step/insertcontract?" + str).then(function(res) {
					console.log(res);
					if(res.data==1){
						alert("提交成功")
						that.$router.go(0);
					}
				})
			},
			getAllusers() {
				let that = this
				let str = qs.stringify(this.user)
				this.$axios.get("http://localhost:8080/user/search?" + str).then(function(res) {
					console.log(res);
					that.users = res.data;
					console.log(that.users);
				})
			},
			handleChange(index) {
				this.step.stepProcessor=this.users[index].userName
			}
		},
		created() {
			this.getAllusers()
		}

	}
</script>
<style>
	
	
</style>>
